<?php
/*
	监听电商客订单状态变更事件
*/
defined('BY_JYA') or exit('error');
$type=$event['type'];
$order=$event['order'];
if(!$type){
	return;
}
if($type=='pay'){
	//付款事件
	$goods=pdo_getall('jy_weishop_order_goods',array('plugin_name'=>'jy_wuliu','orderid'=>$order['id'],'uniacid'=>$_SESSION['uniacid']),array('plugin_name','frompid','merchid'));
	foreach($goods as &$item){
		if($item['frompid']){
			$iteminfo=pdo_get('jy_wuliu_item',array('id'=>$item['frompid'],'uniacid'=>$_SESSION['uniacid']),array('snsid','type','id'));
			$insert=array(
					'uniacid'=>$_SESSION['uniacid'],
					'mid'=>$_SESSION['uid'],
					'pid'=>$iteminfo['id'],
					'snsid'=>$iteminfo['snsid'],
					'type'=>$iteminfo['type'],
					'orderid'=>0,
					'fromuser'=>$this->session('fromuser'),
					'createtime'=>TIMESTAMP
			);
			pdo_insert('jy_wuliu_item_jieli',$insert);
		}
	}
}
if($type=='send_goods'){
	//发货
	
}
if($type=='receive_goods'){
	//收货
	
}
if($type=='complete'){
	//完成
}
